<?php
class IndexModel extends Model
{
    public function getLastestAlbum()
    {
        $this->loadTable('album');
        $this->loadTable('item');
        $rs = $this->tables['album']->get(array('status' => 2));
        if($rs->getSize() != 0)
        {
            $row = $rs->getRow(0);        
            $rs2 = $this->tables['item']->get(array('album_id' => $row->id));
            return $rs2;
        }
        else
            return NULL;
    }

    public function getLastestNews($offset = 0)
    {
        $this->loadTable('post');
        $rs = $this->tables['post']->get(array('category_id' => array('IS NOT',NULL)),array('order' => array('p_date' => 'DESC'),'limit' => 5,'offset' => $offset * 5));
        return $rs;
    }
}